package com.hq.admin.dao;

import com.hq.admin.domain.Operator;
import com.hq.base.dao.BaseDAO;
import com.hq.common.utils.HibernateUtil;
import org.springframework.stereotype.Repository;

import java.util.ArrayList;
import java.util.List;

@Repository
public class OperatorDAO extends BaseDAO<Operator> {

    public List<Operator> queryByName(String name,String password){
        StringBuffer sql=new StringBuffer(" from Operator where 1=1 ");
        List<Object> argList = new ArrayList<Object>();
        sql.append(" and password=? ");
        sql.append(" and username=? ");
        argList.add(password);
        argList.add(name);
        return HibernateUtil.getTemplate().find(sql.toString(),argList.toArray(new Object[]{}));

    }
}
